﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GonzalesMyDraftDetail.aspx.cs" Inherits="GonzalesMyDraftDetail" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <link href="WebStyle.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
<!--
.HorizontalLineFromTop {
	border-top-width: 1px;
	border-top-style: solid;
	border-top-color: #999999;
}
-->


#informationbar{
position: fixed;
left: 0;
width: 100%;
text-indent: 5px;
padding: 5px 0;
background-color: lightyellow;
border-bottom: 1px solid black;
font: bold 12px Verdana;
color:#0000FF;
}

* html #informationbar{ /*IE6 hack*/
position: absolute;
width: expression(document.compatMode=="CSS1Compat"? document.documentElement.clientWidth+"px" : body.clientWidth+"px");
}



    </style>
    
    <link rel="stylesheet" href="js/windowfiles/dhtmlwindow.css" type="text/css" />
    <script type="text/javascript" src="js/windowfiles/dhtmlwindow.js">

    /***********************************************
    * DHTML Window Widget- © Dynamic Drive (www.dynamicdrive.com)
    * This notice must stay intact for legal use.
    * Visit http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    </script>

    <link rel="stylesheet" href="js/modalfiles/modal.css" type="text/css" />
    <script type="text/javascript" src="js/modalfiles/modal.js"></script>
    <script type="text/javascript" src="js/modaltools.js"></script>
        
</head>

<script type="text/javascript" language="javascript" src="js/popcalendar.js"></script>
<script type="text/javascript" language="javascript" src="js/common.js"></script>
<script type="text/javascript" language="javascript" src="js/specialgl.js"></script>
<script type="text/javascript" language="javascript">

    // disabled enter key
    function kH(e) {
        var pK = e ? e.which : window.event.keyCode;
        return pK != 13;
    }
    document.onkeypress = kH;
    if (document.layers) document.captureEvents(Event.KEYPRESS);

	function RowCalculation (RowID) {				
		var AmountClaimed = parseFloat(document.getElementById (RowID + "_TextBoxAmount").value.replace(/,/g,''));
		var ExRate = parseFloat(document.getElementById (RowID + "_TextBoxExRate").value.replace(/,/g,''));		
		var VAT = parseFloat(document.getElementById (RowID + "_TextBoxGSTVAT").value.replace(/,/g,''));		
		
		document.getElementById (RowID + "_TextBoxLocalAmount").value = FormatCurrency(((AmountClaimed + VAT) * ExRate));
		
		// update total
		TotalAmountCalculation();
		
	}
	
	function TotalAmountCalculation() {
	
		var TotalLocalAmount = 0;
		var TotalOwnToCompany = 0;
		var TotalAmountLessAdvance = 0;
		var TotalPersonalExpenses = 0;
		

		for (var x = 0; x < document.forms[0].elements.length; x++) {			
			
            // check for credit card payment		        
            if (document.forms[0].elements[x].name.indexOf ("_HiddenField_DetailType") > 0) {
                var RowID = document.forms[0].elements[x].name.substring (0, 36);
                var IsCreditCard = (document.forms[0].elements[x].value == "1")?true:false;
                var IsPersonal = (document.getElementById(RowID + "_HiddenField_IsPersonal").value == "1")?true:false;
			             
                if (IsCreditCard && TypeCreditCardPayment == 0 && IsPersonal) {                    

                    // Condition 1: Credit Card, Paid By Company, Personal Claim	
                    TotalLocalAmount += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));	        
                    TotalPersonalExpenses += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));						        
                    TotalAmountLessAdvance += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));

                } else if (IsCreditCard && TypeCreditCardPayment == 0 && !IsPersonal) {     

                    // Condition 2: Credit Card, Paid By Company, Non Personal Claim	
					TotalLocalAmount += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));	        
                    TotalAmountLessAdvance += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));					
                    
                } else if (IsCreditCard && TypeCreditCardPayment == 1 && IsPersonal) { 

                    // Condition 3: Credit Card, Paid By Employee, Personal Claim	
                    TotalLocalAmount += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));	        
                    TotalPersonalExpenses += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));						        	
                    //TotalAmountLessAdvance += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));	
                    
                } else if (IsCreditCard && TypeCreditCardPayment == 1 && !IsPersonal) { 

                    // Condition 4: Credit Card, Paid By Employee, Non Personal Claim		
					TotalLocalAmount += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));					
                    //TotalAmountLessAdvance += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));	                            
                } else if(!IsCreditCard) {
					TotalLocalAmount += parseFloat(document.getElementById(RowID + "_TextBoxLocalAmount").value.replace(/,/g,''));								
				}		
            } 	  
			
			// for non-credit card
			if (document.forms[0].elements[x].name.indexOf ("_TextBoxLocalAmount") > 0 && UsingCreditCard == 0) {
			
				TotalLocalAmount += parseFloat(document.forms[0].elements[x].value.replace(/,/g,''));				
			} 						
		}				
		document.getElementById("TextBox_TotalAmount").value = AddThousandSeparators(FormatCurrency(TotalLocalAmount));
		document.getElementById("TextBox_TotalAmountAlreadyPaid").value = AddThousandSeparators(FormatCurrency(TotalAmountLessAdvance));
		document.getElementById("TextBox_Owning").value = AddThousandSeparators(FormatCurrency((TotalLocalAmount - TotalPersonalExpenses)));
		document.getElementById("TextBox_TotalPersonalExpenses").value = "-" + AddThousandSeparators(FormatCurrency(TotalPersonalExpenses));
		
	}
	
	function AmountBoxOnChange (Obj) {
	
		if (isNaN(Obj.value)) {
			Obj.value = Obj.defaultValue;
		} else {
		    Obj.value = FormatCurrency(Obj.value);
			Obj.defaultValue = Obj.value;
			var RowID = Obj.name.substring(0, 36);
			RowCalculation(RowID);	// calculate row
		}	
	}
	
	function VATBoxOnChange (Obj) {
	
		if (isNaN(Obj.value)) {
			Obj.value = Obj.defaultValue;
		} else {
		    Obj.value = FormatCurrency(Obj.value);
			Obj.defaultValue = Obj.value;
			var RowID = Obj.name.substring(0, 36);
			RowCalculation(RowID);	// calculate row
		}	
	}

	function ExchangeRateBoxOnChange(Obj, ErrorMessage) {

		if (isNaN(Obj.value)) {
			Obj.value = Obj.defaultValue;
		} else {
			
			var Proceed = true;
			var RowID = Obj.name.substring(0, 36);
			var CurValue = Obj.value;
			var ActualExRate = 0, DiffValue = 0;
			
			for (var x = 0; x < TargetCurrency.length; x++) {
			    if (TargetCurrency[x] == document.getElementById(RowID + "_DropDownCurrency")[document.getElementById(RowID + "_DropDownCurrency").selectedIndex].value) {
			        ActualExRate = ExchangeRate[x];
			        break;
			    }
			}
			
			DiffValue = (ActualExRate > CurValue)?(ActualExRate - CurValue):(CurValue - ActualExRate);
			
			if (((DiffValue/ActualExRate) * 100) > 5) {
				Proceed = confirm(ErrorMessage);
			} 
			
			if (Proceed) {
				Obj.defaultValue = Obj.value;
				RowCalculation(RowID);	// calculate row
			} else {
				Obj.value = Obj.defaultValue;			
				Obj.focus();
			}
		}	
	}	
	
	function CurrencyOnChange(Obj) {
	    var RowID = Obj.name.substring(0, 36);
	    
	    if (Obj[Obj.selectedIndex].value == LocalCurrency) {
	        document.getElementById(RowID + '_TextBoxExRate').value = "1";
	        
	    } else {	    
	        for (var x = 0; x < TargetCurrency.length; x++) {
	            if (Obj[Obj.selectedIndex].value == TargetCurrency[x]) {
    	        
    	            document.getElementById(RowID + '_TextBoxExRate').value = Round(ExchangeRate[x], 7);
	                break;
	            }
	        }
	    }
	    
	    // re-calculate
	    RowCalculation(RowID);
	
	}
	
	function CountryOnChange(Obj) {
	    
	    var RowID = Obj.name.substring(0, 36);
	    
	    for (var x = 0;  x < CountryArray.length; x++) {
	        
	        if (Obj[Obj.selectedIndex].value == CountryArray[x]) {
	            
	            for (var z = 0; z < document.forms[0].elements.length; z++) {
	            
	                if (document.forms[0].elements[z].name == RowID + "_DropDownCurrency") {
	                    for (var y = 0; y < document.getElementById(RowID + "_DropDownCurrency").length; y++) {
        	            
	                        if (CurrencyArray[x] == document.getElementById(RowID + "_DropDownCurrency")[y].value) {
	                            document.getElementById(RowID + "_DropDownCurrency").selectedIndex = y;
	                            break;
	                        }	            
	                    }
	                }
	            }
	            
	            break;
	        }	    
	    }
	    
	    CurrencyOnChange(document.getElementById(RowID + "_DropDownCurrency"));
	
	}
	
	function ExpenseDetailOnChange (ClaimID, RowID, Obj) {
		
	    // check to see if detail type is available
	    // if not available, mean is a pure cash claim
	    var DetailTypeAvailable = CheckForDetailType();	    
	
	    if (DetailTypeAvailable) {
		    
	        if (Obj[Obj.selectedIndex].value.indexOf("XXX") == 0) {
	            // personal claim selected

	            if (document.getElementById(RowID + "_HiddenField_DetailType").value == "0") {
	                //non creadit card
                    alert("Personal Expense is not applicable for cash transaction.");
                    Obj.selectedIndex = 0;
	            } else {
	                document.getElementById(RowID + "_HiddenField_IsPersonal").value = 1;	            
	                //document.getElementById(RowID + "_TextBoxRemarks").value = "";	 
	            }
	        } else {
	            document.getElementById(RowID + "_HiddenField_IsPersonal").value = 0;
	            //document.getElementById(RowID + "_TextBoxRemarks").value = "";	 	            
	        }
            /*
	        if (special_GLCodeName == GLCode[Obj.selectedIndex - 1] + "," + Obj[Obj.selectedIndex].innerText) { // Compare with special GL in web.config file
	            ShowSpecialPopOut("Transport", document.getElementById(RowID + '_TextBoxRemarks'), 'id=' + ClaimID + '&did=' + RowID + '&remarks=' + document.getElementById(RowID + '_TextBoxRemarks').value + '&amt=' + document.getElementById(RowID + '_TextBoxAmount').value + '&type=' + document.getElementById(RowID + '_HiddenField_DetailType').value);
	        } else {
	            ShowSpecialPopOut(GLCode[Obj.selectedIndex - 1], document.getElementById(RowID + '_TextBoxRemarks'), 'id=' + ClaimID + '&did=' + RowID + '&remarks=' + document.getElementById(RowID + '_TextBoxRemarks').value + '&amt=' + document.getElementById(RowID + '_TextBoxAmount').value + '&type=' + document.getElementById(RowID + '_HiddenField_DetailType').value);
	        } */
	        // Added by thangnv on 2013/10/12 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	        ShowModal(GLPopupType[Obj.selectedIndex - 1], document.getElementById(RowID + '_TextBoxRemarks'), 'id=' + ClaimID + '&did=' + RowID + '&remarks=' + document.getElementById(RowID + '_TextBoxRemarks').value + '&amt=' + document.getElementById(RowID + '_TextBoxAmount').value + '&type=' + document.getElementById(RowID + '_HiddenField_DetailType').value);
	        /*for (var x = 0; x < GLAccPopupType.length; x++) {
	            var gl_account = new Array(3)
	            var gl_account = GLAccPopupType[x].split('♥')
	            var gl_code = gl_account[0]
	            var gl_name = gl_account[1]
	            var glPopType = gl_account[2]
	            if ((GLCode[Obj.selectedIndex - 1] + "♥" + Obj[Obj.selectedIndex].innerText) == (gl_code + "♥" + gl_name)) {
	                ShowModal(glPopType, document.getElementById(RowID + '_TextBoxRemarks'), 'id=' + ClaimID + '&did=' + RowID + '&remarks=' + document.getElementById(RowID + '_TextBoxRemarks').value + '&amt=' + document.getElementById(RowID + '_TextBoxAmount').value + '&type=' + document.getElementById(RowID + '_HiddenField_DetailType').value);
	                break;
	            }
	        } */
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	        //document.getElementById(RowID + "_TextBoxRemarks").value = "";
	        
            TotalAmountCalculation();	            		    
		    
        } else {
            // this is pure cash, no personal claim allow
            
            if (Obj[Obj.selectedIndex].value.indexOf("XXX") == 0) {
                alert("Personal Expense is not applicable for cash transaction.");
                Obj.selectedIndex = 0;
            } else {
                /*
                if (special_GLCodeName == GLCode[Obj.selectedIndex - 1] + "," + Obj[Obj.selectedIndex].innerText) { // Compare with special GL in web.config file
                    ShowSpecialPopOut("Transport", document.getElementById(RowID + '_TextBoxRemarks'), 'id=' + ClaimID + '&did=' + RowID + '&remarks=' + document.getElementById(RowID + '_TextBoxRemarks').value + '&amt=' + document.getElementById(RowID + '_TextBoxAmount').value + '&type=0');                               
                } else {
                    ShowSpecialPopOut(GLCode[Obj.selectedIndex - 1], document.getElementById(RowID + '_TextBoxRemarks'), 'id=' + ClaimID + '&did=' + RowID + '&remarks=' + document.getElementById(RowID + '_TextBoxRemarks').value + '&amt=' + document.getElementById(RowID + '_TextBoxAmount').value + '&type=0');                               
                } */
                // Added by thangnv on 2013/10/12 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                ShowModal(GLPopupType[Obj.selectedIndex - 1], document.getElementById(RowID + '_TextBoxRemarks'), 'id=' + ClaimID + '&did=' + RowID + '&remarks=' + document.getElementById(RowID + '_TextBoxRemarks').value + '&amt=' + document.getElementById(RowID + '_TextBoxAmount').value + '&type=0');
                /*for (var x = 0; x < GLAccPopupType.length; x++) {
                    var gl_account = new Array(3)
                    var gl_account = GLAccPopupType[x].split('♥')
                    var gl_code = gl_account[0]
                    var gl_name = gl_account[1]
                    var glPopType = gl_account[2]
                    if ((GLCode[Obj.selectedIndex - 1] + "♥" + Obj[Obj.selectedIndex].innerText) == (gl_code + "♥" + gl_name)) {
                        ShowModal(Obj[Obj.selectedIndex].Attributes["PopupType"].value , document.getElementById(RowID + '_TextBoxRemarks'), 'id=' + ClaimID + '&did=' + RowID + '&remarks=' + document.getElementById(RowID + '_TextBoxRemarks').value + '&amt=' + document.getElementById(RowID + '_TextBoxAmount').value + '&type=0');
                        break;
                    }
                } */
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //document.getElementById(RowID + "_TextBoxRemarks").value = "";	
            }
        }
	        
	     document.getElementById(RowID + "_TextBoxAmount").onfocus();
	}
	
	function CheckForDetailType() {
	    var DetailTypeFound = false;
	    
	    for (var x = 0; x < document.forms[0].elements.length; x++) {	
	    
	        if (document.forms[0].elements[x].name.indexOf("_HiddenField_DetailType") > 0 ){
	            DetailTypeFound = true;
	        }
	    }
	    
	    return DetailTypeFound;
	    
	}
	
	function ExpenseDetailAmountValidation(Obj, CurrentObj) {
	//alert(Obj);
	//alert(GLCode[Obj.selectedIndex-1]);
	    if(Obj != null) {
	        // GLPopupType[Obj.selectedIndex - 1]
	        //if (RowAmountIsControlled(GLCode[Obj.selectedIndex-1])) {
	        if (GLPopupType[Obj.selectedIndex - 1] != "") { // Added by thangnv on 20131031
	            CurrentObj.blur();
	            CurrentObj.style.color = "#FF6600";
	            CurrentObj.tabIndex = -1;
	        }
	        else
	        {
	            CurrentObj.tabIndex = 0;
	            CurrentObj.style.color = "#333333";
	        }
	    }
	}

  function Validate(ValidationText) {
  
    var valid = true;
    var empty = false;
    var RowID = "";
    var HavingReceipts = true;
 
    for (var x = 0; x < document.forms[0].elements.length; x++) {
      
      
      // get the id first
      if (document.forms[0].elements[x].name.indexOf("_DropDownClaimType") > 0) {        
        
        RowID = document.forms[0].elements[x].name.substring(0, 36);
                
        // Check if to ignore the row
        if ( 
          (document.getElementById(RowID + "_DropDownClaimType").selectedIndex == 0) && 
          (document.getElementById(RowID + "_TextBoxRemarks").value == "")  && 
          //(document.getElementById(RowID + "_TextBoxCity").value == "")  && 		  
          (document.getElementById(RowID + "_TextBoxDate").value == "") &&      
          (parseFloat(document.getElementById(RowID + "_TextBoxAmount").value.replace(/,/g,'')) == 0) && 
          (document.getElementById(RowID + "_CheckBoxReceipts").checked == false)            
          ) {
            // can ignore
          } else {
          
            // Claim type
            if (document.getElementById(RowID + "_DropDownClaimType").selectedIndex == 0) {
				document.getElementById(RowID + "_DropDownClaimType").className = "ValidatedErrorComponent";
              	valid = false;
            } else {
				document.getElementById(RowID + "_DropDownClaimType").className = "FormDropDown";			
			}       
			
            // Country
            if (document.getElementById(RowID + "_DropDownCountry").selectedIndex == 0) {
				document.getElementById(RowID + "_DropDownCountry").className = "ValidatedErrorComponent";			
              	valid = false;
            } else {
				document.getElementById(RowID + "_DropDownCountry").className = "FormDropDown";			
			} 			          
            
            // City
            /*
            if (document.getElementById(RowID + "_TextBoxCity").value == "") {
				document.getElementById(RowID + "_TextBoxCity").className = "ValidatedErrorComponent";			
              	valid = false;
            } else {
				document.getElementById(RowID + "_TextBoxCity").className = "DetailGridTextBox";			
			} 
			*/                
						
            // Date
            if (document.getElementById(RowID + "_TextBoxDate").value == "") {
				document.getElementById(RowID + "_TextBoxDate").className = "ValidatedErrorComponent";			
              	valid = false;
            } else {
                
                var CurrentDate = DateConvert(document.getElementById(RowID + "_TextBoxDate").value, CurrentDateFormat);
                var Today = new Date();
                
                if (CurrentDate > Today) {
                    document.getElementById(RowID + "_TextBoxDate").className = "ValidatedErrorComponent";			
              	    valid = false;
                } else {
            
				    document.getElementById(RowID + "_TextBoxDate").className = "DetailGridTextBox";			
				}
			}                          
          
            // Amount
            if (parseFloat(document.getElementById(RowID + "_TextBoxAmount").value.replace(/,/g,'')) == 0) {
				document.getElementById(RowID + "_TextBoxAmount").className = "ValidatedErrorComponent";			
              	valid = false;
            } else {
				document.getElementById(RowID + "_TextBoxAmount").className = "DetailGridTextBox";			
			}      
			
			// Receipts
			if (!document.getElementById(RowID + "_CheckBoxReceipts").checked) {
			    HavingReceipts = false;        
            }
                       
          }

      }     
         
    }      
	
	// check for negative value
	if (parseFloat(document.getElementById("TextBox_Owning").value.replace(/,/g,'')) < 0) {
		if (document.getElementById("TextBox_ChequeNo").value == "" || document.getElementById("TextBox_IssuedBank").value == "") {
		    document.getElementById("TextBox_ChequeNo").className = document.getElementById("TextBox_IssuedBank").className = "ValidatedErrorComponent";
			valid = false;
		} else {
		    document.getElementById("TextBox_ChequeNo").className = document.getElementById("TextBox_IssuedBank").className = "FormTextBox";
		}
	}
	
	// check for purpose
	if (document.getElementById("TextBox_Reasons").value == "") {
	    document.getElementById("TextBox_Reasons").className = "ValidatedErrorComponent";
	    valid = false;	    
	} else {
	    document.getElementById("TextBox_Reasons").className = "FormTextBox";
	}
   
    if (!valid) alert(ValidationText);   
    
    if (valid) {
        // check for receipt
        // receipt is optional, reminder will shown if no receipt
        if (!HavingReceipts) {
            valid = confirm(NoReceipt);
        }        
    }
  
    return valid;
  }
  
  
  function DateConvert(DateString, CurrentDateFormat) {
  
    var CurrentDate;
    var DateArray = DateString.split("/");
    
    switch (CurrentDateFormat) {
    
        case "dd/mm/yyyy":
            CurrentDate = new Date(DateArray[2], (parseInt(DateArray[1])-1), DateArray[0]);
            break;
            
        case "mm/dd/yyyy":
            CurrentDate = new Date(DateArray[2], (parseInt(DateArray[0])-1), DateArray[1]);
            break;
            
        case "yyyy/dd/mm":
            CurrentDate = new Date(DateArray[0], (parseInt(DateArray[2])-1), DateArray[1]);
            break;
            
        case "yyyy/mm/dd":
            CurrentDate = new Date(DateArray[0], (parseInt(DateArray[1])-1), DateArray[2]);
            break;                                    
    
    }
  
    return CurrentDate;
  }

   function CheckReceipts(Obj, ID) {
    if (Obj.value != "") {
        document.getElementById(ID + "_CheckBoxReceipts").checked = true;
    } else {
        document.getElementById(ID + "_CheckBoxReceipts").checked = false;    
    }
   }

		
		function StartTimer () {
			timerID = setInterval("ShowCountDown()",1000);
			var isNew = isnew;
            
            firstTime = 1;
		}
		
		var firstTime = 1;
		
		function ShowCountDown () {
		  
		  seconds++;

          if (seconds > 59) {
               minutes++;
               seconds = 0;
               }
              var min = minutes;
              var sec = seconds;
                         
              if(minutes < 10)
                min = "0" + minutes;
              if(seconds < 10)
                sec = "0" + seconds;
                
              //document.all.LabelValue_ElapsedTime.innerHTML = min + ":" + sec;
               // var infobar=new informationbar()
               // infobar.setContent(min + ':' + sec);
                document.getElementById("informationbar").innerHTML = "Elapsed Time : " + min + ":" + sec;
               // infobar.initialize()
            
              
           if(minutes >= interval && firstTime == 1)
           {
               //window.open("GonzalesToolTimerAlert.aspx","Notification","","");
               //ModalWindow = dhtmlmodal.open("Notification", "iframe", "GonzalesToolsTimerAlert.aspx", "ToolBox", "width=350px,height=50px,center=1,resize=0,scrolling=0");
		
		       //ModalWindow.onclose = function () {
		       //  parent.ModalWindow.hide(this);
				//return true;
				//Blink('Label_ElapsedTime');
				//document.getElementById('Label_ElapsedTime').style.backgroundColor ="#FF6600";
				firstTime = 0;
				//document.getElementById('LabelValue_ElapsedTime').style.color ="#FF6600";
				 document.getElementById("informationbar").style.color ="#FF6600";
				 document.getElementById("informationbar").style.fontSize= '100%'; 
				 document.getElementById("informationbar").style.textAlign='center'; 
				Blink('LabelValue_ElapsedTime');
				
		    //}		
           }
		}
		
window.onerror = null;
 var bName = navigator.appName;
 var bVer = parseInt(navigator.appVersion);
 var NS4 = (bName == "Netscape" && bVer >= 4);
 var IE4 = (bName == "Microsoft Internet Explorer" 
 && bVer >= 4);
 var NS3 = (bName == "Netscape" && bVer < 4);
 var IE3 = (bName == "Microsoft Internet Explorer" 
 && bVer < 4);
 var blink_speed=100;
 var i=0;
 
if (NS4 || IE4) {
 if (navigator.appName == "Netscape") {
 layerStyleRef="layer.";
 layerRef="document.layers";
 styleSwitch="";
 }else{
 layerStyleRef="layer.style.";
 layerRef="document.all";
 styleSwitch=".style";
 }
}


function Blink(layerName){
 if (NS4 || IE4) { 
     if(i%2==0)
     {
     //eval(layerRef+'["'+layerName+'"]'+
     //styleSwitch+'.visibility="visible"');   
     }
     else
     {
     //eval(layerRef+'["'+layerName+'"]'+
     //styleSwitch+'.visibility="hidden"');
     document.getElementById("informationbar").innerHTML = "";    
     }
 } 
 if(i<1)
     {
     i++;
     } 
     else
     {
     i--
     }
 setTimeout("Blink('"+layerName+"')",300);
}
    //Finds y value of given object
function findPos(obj) {
	try{    
        var objpos = ObjectPosition(obj);   
        }
    catch(e)
        {
        
        }  
    try{    
        scroll(0,objpos[1]);   
        }
    catch(e)
        {
        }  
        try{     
         window.scrollTo(0,objpos[1]); 
        }
    catch(e)
        {
        }
}
function scrollWindow()
   {
    //Get object
    //var SupportDiv = document.getElementById('lb_test');
 
    //Scroll to location of SupportDiv on load
   // window.scroll(0,findPos(SupportDiv));
//    var infobar=new informationbar()
////var a = document.getElementById('Label_PageTitle').innerHTML;
// infobar.setContent(document.getElementById('LabelValue_ElapsedTime').innerHTML)
// //infobar.setfrequency('session') //Uncomment this line to set information bar to only display once per browser session!
//// infobar.initialize()
 

   }


function informationbar(){
this.displayfreq="always"
this.content='<a href="javascript:informationbar.close()"><img src="close.gif" style="width: 14px; height: 14px; float: right; border: 0; margin-right: 5px" /></a>'
}

informationbar.prototype.setContent=function(data){
this.content=this.content+data
document.write('<div id="informationbar" style="top: -500px">'+this.content+'</div>')
}

informationbar.prototype.animatetoview=function(){
var barinstance=this
if (parseInt(this.barref.style.top)<0){
this.barref.style.top=parseInt(this.barref.style.top)+5+"px"
setTimeout(function(){barinstance.animatetoview()}, 50)
}
else{
if (document.all && !window.XMLHttpRequest)
this.barref.style.setExpression("top", 'document.compatMode=="CSS1Compat"? document.documentElement.scrollTop+"px" : body.scrollTop+"px"')
else
this.barref.style.top=0
}
}

informationbar.close=function(){
document.getElementById("informationbar").style.display="none"
if (this.displayfreq=="session")
document.cookie="infobarshown=1;path=/"
}

informationbar.prototype.setfrequency=function(type){
this.displayfreq=type
}

informationbar.prototype.initialize=function(){
if (this.displayfreq=="session" && document.cookie.indexOf("infobarshown")==-1 || this.displayfreq=="always"){
this.barref=document.getElementById("informationbar")
this.barheight=parseInt(this.barref.offsetHeight)
this.barref.style.top=this.barheight*(-1)+"px"
this.barref.style.fontSize= '100%'; 
this.barref.style.textAlign='center'; 
this.animatetoview()
}
}

window.onunload=function(){
this.barref=null
}


</script>
<body>
    <form id="form1" runat="server">
    <div>
    <p>&nbsp</p>
      <table width="100%" border="0" cellspacing="1" cellpadding="8">
        <tr>
          <td class="PageTitle" width="70%"><asp:Label ID="Label_PageTitle" Text='Expense' runat="server" /></td>         
          <td class="PageTitle" align="center" style="width: 234px"><asp:Label CssClass="NormalBodyText" ID="Label_LastUpdate" Text='Last Saved : ' runat="server" /><asp:Label ID="LabelValue_LastUpdate" CssClass="NormalBodyText" runat="server" /></td>
        </tr>
        <tr>
          <td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td width="20%" valign="top"><asp:Label CssClass="FormTitle" ID="Label_Information" runat="server" Text='My Draft Detail' />                            </td>
            <td width="3" class="VerticalDivider">&nbsp;</td>
            <td><asp:Label CssClass="NormalBodyText" ID="Label_Remarks" runat="server" Text='You should save your draft every 20 minutes to prevent data loss. Do note that information entered in the web based form is unrecoverable : (1) if you navigate away from this page before you saved. (2) if the webpage timeout due to inactivity or network failure.' /></td>
            </tr>
           <tr>
            <td colspan="3">&nbsp;</td>
           </tr>
           <tr>
            <td colspan="3" valign="top"><asp:Table CellPadding="5" CellSpacing="0" ID="Table_MessageBox" Width="100%" runat="server" Visible="false">
              <asp:TableRow>
                <asp:TableCell CssClass="ErrorBox" ></asp:TableCell>
              </asp:TableRow>
            </asp:Table>
                <asp:Table ID="Table_PolicyChecking_Pass" runat="server" CellPadding="5" CellSpacing="0"
                    Visible="False" Width="100%" CssClass="ErrorBox">
                    <asp:TableRow>
                        <asp:TableCell></asp:TableCell>
                    </asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell><asp:Button CssClass="FormButton" ID="Button_Continue" runat="server" Text="Continue" OnClick="Button_Continue_Click" /></asp:TableCell>
                    </asp:TableRow>                    
                </asp:Table>
                <asp:Table ID="Table_PolicyChecking_Fail" runat="server" CellPadding="5" CellSpacing="0"
                    Visible="False" Width="100%" CssClass="ErrorBox">
                    <asp:TableRow>
                        <asp:TableCell></asp:TableCell>
                    </asp:TableRow>
                </asp:Table>                
            </td>
          </tr>
          <tr>
                <td width="100%" colspan="3" valign="middle"><table width="100%" border="0" cellpadding="5" cellspacing="0" class="FormBorder">
                    <tr>
                      <td colspan="4" align="right" class="FormLineItemAlt"></td>
                    </tr>
                    <tr>
                      <td width="160" class="FormLineItem"><asp:Label CssClass="FormField" ID="Label_EmployeeName" runat="server" Text='Employee Name:' /></td>
                      <td width="35%" class="FormLineItem"><asp:Label CssClass="NormalBodyText" ID="LabelValue_EmployeeName" runat="server" /></td>
                      <td width="130" class="FormLineItem"><asp:Label CssClass="FormField" ID="Label_Status" runat="server" Text='Status:' /></td>
                      <td width="25%" class="FormLineItem"><asp:Label CssClass="NormalBodyText" ID="LabelValue_Status" runat="server" /></td>
                    </tr>
                    <tr>
                      <td class="FormLineItemAlt"><asp:Label CssClass="FormField" ID="Label_EmployeeNo" runat="server" Text='Employee No:' /></td>
                      <td class="FormLineItemAlt"><asp:Label CssClass="NormalBodyText" ID="LabelValue_EmployeeNo" runat="server" /></td>
                      <td class="FormLineItemAlt"><asp:Label CssClass="FormField" ID="Label_EmployeeNo2" runat="server" Text='Approver:' /></td>
                      <td class="FormLineItemAlt"><asp:Label CssClass="NormalBodyText" ID="LabelValue_Approver" runat="server" /></td>
                    </tr>
                    <tr>
                      <td class="FormLineItem"><asp:Label CssClass="FormField" ID="Label_ClaimPeriod" runat="server" Text='Claim Period:' /></td>
                      <td class="FormLineItem"><asp:DropDownList CssClass="FormTextBox" ID="DropDownList_claimPeriodYear" runat="server" />&nbsp;<asp:DropDownList CssClass="FormTextBox" ID="DropDownList_ClaimPeriodMonth" runat="server" /></td>
                      <td class="FormLineItem"><asp:Label CssClass="FormField" ID="Label_ClaimNum2" runat="server" Text='Date Created:' /></td>
                      <td class="FormLineItem"><asp:Label CssClass="NormalBodyText" ID="LabelValue_CreatedDate" runat="server" /></td>
                    </tr>
                    <tr>
                      <td class="FormLineItemAlt"><asp:Label CssClass="FormField" ID="Label_Purpose" runat="server" Text='Purpose:' />&nbsp; <asp:Label ID="Label2" runat="server" CssClass="NormalBodyText"></asp:Label></td>
                      <td class="FormLineItemAlt" colspan="3"><asp:TextBox CssClass="FormTextBox" ID="TextBox_Reasons" runat="server" TextMode="SingleLine" MaxLength="50" Columns="50"/></td>

                    </tr>
                    <tr>
                      <td colspan="4" class="FormLineItem"><asp:Label ID="Label_Response" runat="server" /></td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td colspan="3" valign="top" class="HorizontalLineFromTop">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td><table width="100%" border="0" cellspacing="2" cellpadding="1">
                          <tr>
                            <td align="right"><asp:DropDownList CssClass="FormDropDown" ID="DropDownList_SortBy" runat="server" OnSelectedIndexChanged="DropDownList_SortBy_SelectedIndexChanged" AutoPostBack="True"></asp:DropDownList>                            </td>
                          </tr>
                        </table></td>
                      </tr>
                      
                      <tr>
                        <td><table width="100%" border="0" cellpadding="2" cellspacing="0" class="FormBorder">
                            <tr>
                              <td><asp:Table ID="Table_ClaimDetailGrid" runat="server" Width="100%" CellPadding="0" CellSpacing="1" CssClass="FormBorder"> </asp:Table></td>
                            </tr>
                            <tr>
                              <td align="left">                              
                              <asp:Button CssClass="FormButton" ID="Button_Remove" runat="server" Text="Remove Selected Items" OnClick="Button_Remove_Click" />
                              <asp:Button CssClass="FormButton" ID="Button_AddMore" runat="server" Text="Add More Items" OnClick="Button_AddMore_Click" /></td>
                            </tr>
                          </table></td>
                      </tr>
                </table>                </td>
              </tr>
              <tr>
                <td colspan="3" valign="top" style="height: 308px"><table width="500" border="0" cellpadding="5" cellspacing="1" class="FormBorder">
                    <tr>
                        <td class="GridViewItem" style="height: 29px">
                            <asp:Label CssClass="FormField" ID="Label_TotalAmount" runat="server" Text="Total Amount in Local Currency:" /></td>
                        <td align="right" class="GridViewItem" style="height: 29px">
                            <asp:TextBox ID="TextBox_TotalAmount" runat="server"  Font-Size="12px" TabIndex="-1">0.00</asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="GridViewItem" style="height: 23px"><asp:Label ID="Label_TotalPersonalExpenses" runat="server" Text='Less Personal Expenses:' CssClass="FormField" /></td>
                        <td align="right" class="GridViewItem" style="height: 23px">                          <asp:TextBox CssClass="DetailGridTextBox" ID="TextBox_TotalPersonalExpenses" runat="server"  Font-Size="12px" Text="0.00" TextMode="SingleLine" TabIndex="-1" />                      </td>
                    </tr>
                    <tr>
                        <td class="GridViewItem" style="height: 23px"><asp:Label ID="Label_TotalAmountLessPaid" runat="server" Text='Less card transactions:' CssClass="FormField" /></td>
                        <td align="right" class="GridViewItem" style="height: 23px">                          <asp:TextBox CssClass="DetailGridTextBox" ID="TextBox_TotalAmountAlreadyPaid" runat="server"  Font-Size="12px" Text="0.00" TextMode="SingleLine" TabIndex="-1" />                        </td>
                    </tr>
                  <tr>
                    <td class="GridViewItem"><span class="GridViewItem" style="height: 23px">
                      <asp:Label CssClass="FormField" ID="Label_OwningEmployee" runat="server" Text='Owing to/from employee' />                      
                    </span></td>
                    <td align="right" class="GridViewItem"><span class="GridViewItem" style="height: 23px">
                      <asp:TextBox CssClass="DetailGridTextBox" ID="TextBox_Owning" runat="server"  Font-Size="12px" Text="0.00" TextMode="SingleLine" TabIndex="-1" />                    
                      </span></td>
                  </tr>
                  <tr>
                    <td colspan="2" class="GridViewItem"><table width="100%" border="0" cellspacing="1" cellpadding="5">
                        <tr>
                          <td><asp:Label CssClass="FormField" ID="Label_ChequeNo" runat="server" Text="Cheque No.:" /></td>
                          <td><asp:TextBox CssClass="FormTextBox" ID="TextBox_ChequeNo" runat="server" TextMode="SingleLine" /></td>
                          <td><asp:Label CssClass="FormField" ID="Label_IssuedBank" runat="server" Text='Issued Bank:' /></td>
                          <td><asp:TextBox CssClass="FormTextBox" ID="TextBox_IssuedBank" runat="server" TextMode="SingleLine" /></td>
                        </tr>
                      </table></td>
                  </tr>
                  
                  <tr>
                    <td colspan="2" class="GridViewItem"><table border="0" cellspacing="1" cellpadding="2">
                      <tr>
                        <td style="height: 28px"><asp:Button CssClass="FormButton" ID="Button_CreditCard" runat="server" Text="Import Credit Card Items" OnClick="Button_CreditCard_Click" /></td>
                        <td style="height: 28px"><asp:Button CssClass="FormButton" ID="Button_FileManager" runat="server" Text="Attach Supporting Documents" /></td>
                        <td style="height: 28px"><asp:Button CssClass="FormButton" ID="Button_Save" runat="server" Text="Save" OnClick="Button_Save_Click" /></td>
                        <td style="height: 28px"><asp:Button CssClass="FormButton" ID="Button_SavenExit" runat="server" Text="Save & Exit" OnClick="Button_Save_Exit_Click" /></td>
                        <td style="height: 28px"><asp:Button CssClass="FormButton" ID="Button_Submit" runat="server" Text="Submit Claim" OnClick="Button_Submit_Click"  /></td>
                      </tr>
                    </table></td>
                  </tr>
                  
                </table>
                </td>
              </tr>
              <tr>
                <td colspan="3" valign="top">&nbsp;</td>
              </tr>
              
          </table></td>
        </tr>
      </table>
    </div>
    </form>
</body>

<script language="javascript" type="text/javascript">
    TotalAmountCalculation();
    StartTimer ();
  
	//window.onload=scrollWindow
	
	<!--Invocation code-->
	              //document.getElementById(RowID + '_TextBoxExRate').value
 //var SupportDiv = document.getElementById('Label_PageTitle').value;

 // Added by thangnv on 20130829   
 var special_GLCodeName = '<%=Special_GLCodeName%>';
    
 var infobar=new informationbar()
//var a = document.getElementById('Label_PageTitle').innerHTML;
 //infobar.setContent('Elapsed Time : ' + document.getElementById('LabelValue_ElapsedTime').innerHTML)
  infobar.setContent('Elapsed Time : ')
 //infobar.setfrequency('session') //Uncomment this line to set information bar to only display once per browser session!
 infobar.initialize()
 
</script>

</html>
